﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using MasoQna.Models;

namespace MasoQna.Infrastructure
{
    public class MqDbContext : DbContext
    {
        public DbSet<Writing> Writings { get; set; }
        public DbSet<User> Users { get; set; }
        public DbSet<Tag> Tags { get; set; }
        public DbSet<UserMapping> UserMappings { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Writing>().HasOptional<User>(m => m.Writer);
        }
    }
}